package com.zhrj.exam.entity;

import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zhrj.exam.excel.IdConverter;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;

@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("blade_user") // 对应数据库表
public class BladeUser {

    @TableId(value = "id", type = IdType.AUTO) // 主键自增
    @ExcelProperty(value = "用户ID",converter = IdConverter.class)
    private Long id;
    @ExcelProperty("租户ID")

    private String tenantId;
    @ExcelProperty("编码")

    private String code;
    @ExcelProperty("账号")

    private String account;
    @ExcelProperty("密码")

    private String password;
    @ExcelProperty("姓名")

    private String name;
    @ExcelProperty("真实姓名")

    private String realName;

    @ExcelProperty("头像")

    private String avatar;
    @ExcelProperty("邮箱")

    private String email;
    @ExcelProperty("电话")

    private String phone;

    // 日期格式化 (接收&返回)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") // 接收参数
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") // 返回格式
    @ExcelProperty("生日")

    private LocalDateTime birthday;

    @ExcelProperty(value = "性别",converter = com.springboot.others.excel.GenderConverter.class)
    private Integer sex;

    @ExcelProperty(value = "角色id",converter = IdConverter.class)
    private Long roleId;

    @ExcelProperty(value = "部门id",converter = IdConverter.class)
    private Long deptId;

    @ExcelProperty(value = "职位id",converter = IdConverter.class)
    private Long postId;

    @ExcelProperty(value = "创建人id",converter = IdConverter.class)
    private Long createUser;

    @ExcelProperty(value = "创建部门id",converter = IdConverter.class)
    private Long createDept;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ExcelProperty("创建时间")
    private LocalDateTime createTime;

    @ExcelProperty(value = "更新人id",converter = IdConverter.class)
    private Long updateUser;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ExcelProperty("更新时间")
    private LocalDateTime updateTime;

    @ExcelProperty("状态")

    private Integer status;
    @ExcelProperty("是否删除")

    private Integer isDeleted;
}
